<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile
/**
 * @var \Magento\Paypal\Block\Express\Shortcut $block
 */
?>
<?php
$labelPosition = '';
if ($block->isOrPositionBefore()) {
    $labelPosition = ' before';
} elseif ($block->isOrPositionAfter()) {
    $labelPosition = ' after';
}
$shortcutHtmlId = $block->escapeHtml($block->getShortcutHtmlId());
$isInCatalogProduct = false;
if ($block->getIsInCatalogProduct()) {
    $isInCatalogProduct = $block->getIsInCatalogProduct();
}
?>
<div data-label="<?php echo $block->escapeHtml(__('or')); ?>"
     class="paypal checkout <?php /* @noEscape */ echo $labelPosition; ?> paypal-logo
        <?php /* @noEscape */ echo $shortcutHtmlId; ?>"
     data-mage-init='{
     "paypalCheckout": {
                "isCatalogProduct": "<?php /* @noEscape */ echo !empty($isInCatalogProduct) ? (bool)$isInCatalogProduct : false;?>",
                "shortcutContainerClass": "<?php /* @noEscape */ echo "." . $shortcutHtmlId; ?>"
            }
     }'
    >
    <input type="image" data-action="checkout-form-submit"
           data-checkout-url="<?php echo $block->escapeUrl($block->getCheckoutUrl()); ?>"
           src="<?php echo $block->escapeUrl($block->getImageUrl()); ?>"
           alt="<?php echo $block->escapeHtml(__('Checkout with PayPal')); ?>"
           title="<?php echo $block->escapeHtml(__('Checkout with PayPal')); ?>"/>
    <?php if ($block->getAdditionalLinkImage()): ?>
        <?php $linkImage = $block->getAdditionalLinkImage(); ?>
        <a href="<?php echo $block->escapeUrl($linkImage['href']);?>">
            <img src="<?php echo $block->escapeHtml($linkImage['src']);?>" />
        </a>
    <?php endif; ?>
</div>
